#include <bits/stdc++.h>
using namespace std;
#define N 1000
typedef struct Node
{
    int num, val;
    int left, right;
}Node;
Node node[N];
int p = 1;
int w[200];
int createTree(int l, int r)
{
    int np = p++;
    if(l == r)
    {
        node[np].num = l;
        node[np].val = w[l];
    }
    else
    {
        int m = (l + r)/2;
        int leftRoot = createTree(l, m);
        int rightRoot = createTree(m+1, r);
        node[np].left = leftRoot; 
        node[np].right = rightRoot; 
        if(node[leftRoot].val > node[rightRoot].val)
        {
            node[np].val = node[leftRoot].val;
            node[np].num = node[leftRoot].num;
        } 
        else
        {
            node[np].val = node[rightRoot].val;
            node[np].num = node[rightRoot].num;
        }
    }
    return np;
}
int main()
{
    int n1, n;
    cin>>n1;
    n = (int)pow(2, n1);
    for(int i = 1; i <= n; ++i)
        cin>>w[i]; 
    int root = createTree(1, n);
    int leftRoot = node[root].left, rightRoot = node[root].right;
    if(node[leftRoot].val < node[rightRoot].val)
        cout<<node[leftRoot].num;
    else
        cout<<node[rightRoot].num;
    return 0;
}
